<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <div id="app">
        <button @click="fn">点我啊</button>
    </div>

    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data() {
                return {
                    msg: '你好'
                }
            },
            methods: {
                fn() {
                    // this代表当前实例化出来的Vue对象
                    // true
                    console.log(app === this)
                    // Vue会在这个对象刚创建的某个阶段里
                    // 会把data中数据和methods中的方法挂载到这个对象的最外层
                    console.log(this)
                    console.log(this.msg)
                    this.fn2()
                },

                fn2() {
                    console.log('我是fn2')
                }
            }
        })
    </script>
</body>

</html>